

#include "platform_time.h"




long platform_get_microsecond(void) //us
{
    struct timeval timestamp = {};
    if (0 == gettimeofday(&timestamp, NULL))
        return timestamp.tv_sec * 1000000 + timestamp.tv_usec;
    else
        return 0;
}

long platform_get_millisecond(void)//ms
{
    struct timeb timestamp = {};

    if (0 == ftime(&timestamp))
        return timestamp.time * 1000 + timestamp.millitm;
    else
        return 0;
}

long platform_get_second(void) //s
{
    return time(NULL);
}



